package com.example.HelloSpace.network;


import com.example.HelloSpace.R;
import com.example.HelloSpace.utils.MyApp;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class RetrofitClient {
    private static String BASE_URL ; // 确保以斜杠结尾
    private static Retrofit retrofit = null;

    public static Retrofit getClient() {
        BASE_URL= MyApp.getAppContext().getString(R.string.SERVER_URL);
        if (retrofit == null) {
            retrofit = new Retrofit.Builder()
                    .baseUrl(BASE_URL)
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();
        }
        return retrofit;
    }
}